<template>
    <div class="mine">
        <el-card class="box-card">
            <div slot="header" class="clearfix">
                <span>个人中心</span>
            </div>
            <div style="float: left;">
                <div v-for="(user , index) in userList" :key="user.id" class="text item">
                    <router-link class="atic"  :to="user.path"><span :class="activeIndex == index ? 'active':''" @click="changect(index)">{{ user.title }}</span></router-link>
                </div>
            </div>
            <div class="right" style="float: right;">
                <router-view></router-view>
            </div>
        </el-card>
    </div>
</template>

<script>
export default {
    data() {
        return {
            activeIndex:0,
            userList: [{
                id: 1,
                title: "我的信息",
                path:'/mine/messAge'
            }, {
                id: 2,
                title: "我的评论",
                path:'/mine/comMent'
            }, {
                id: 3,
                title: "我的点赞",
                path:'/mine/giVe'
            }, {
                id: 4,
                title: "我的收藏",
                path:'/mine/colLect'
            }]
        };
    },
    methods: {
        changect(index){
            this.activeIndex = index
        }
    },
}
</script>

<style lang="less">
.mine {
    width: 1200px;
    margin: 120px auto 0;
}

.text {
    font-size: 14px;
    cursor: pointer;
}

.item {
    margin-bottom: 18px;
    width: 200px;
}

.clearfix:before,
.clearfix:after {
    display: table;
    content: "";
}

.clearfix:after {
    clear: both
}

.box-card {

    width: 1200px;
    height: 600px;
}

.el-card__body {
    height: 100%;
}
.right{
    width: 950px;
}
.atic{
    text-decoration: none;
    color: #000;
}
.active{
    color: red;
    font-weight: bold;
}
</style>